﻿package stfei.HorizList
{
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.text.TextField;
    
    import stfei.HorizList.Obj.*;
    import stfei.HorizList.core.*;
    /**
    * ...
    * 新闻列表实现
    */
    public class newsList extends HorizList
    {
        public function newsList(mcW:Number , mcH:Number)
        {
            super(mcW , mcH )
        }
        protected override function getParseXml():IparseXml
        {
            return new newsXml()
        }
        protected override function getRegPoint():IRegPoint
        {
            var RegPoint:RegPointList = new RegPointList();
            RegPoint.mcW = _MCW;
            RegPoint.mcH = _MCH;
            RegPoint._listColumn = _listColumn;
            RegPoint._listRow = _listRow;
            return RegPoint;
        }
        protected override function crateMovieClip(tol:Number):void
        {
            var ay:Number = RegPointArr[tol - 1][1];
            var ax:Number = RegPointArr[tol - 1][0];
            var newTitle:String = DataArr[tol - 1][0];
            var newLink:String = DataArr[tol - 1][1];
            var newUpTime:String = DataArr[tol - 1][2]
            var inNewDataMC:MovieClip = new MovieClip()
            inNewDataMC.graphics.beginFill(0xD01f23)
            inNewDataMC.graphics.drawRect(0 , 0 , 570 , 20)
            inNewDataMC.graphics.endFill()
            inNewDataMC.x = ax
            inNewDataMC.y = ay
            inNewDataMC.newLink = newLink
            inNewDataMC.buttonMode = true
            inNewDataMC.addEventListener(Event.ADDED , addMovieEve)
            inNewDataMC.addEventListener(Event.ENTER_FRAME , effect)
            var NewTitleText:TextField = new TextField
            NewTitleText.text = newTitle
            NewTitleText.width = 470
            NewTitleText.height = 20
            NewTitleText.x = 5
            NewTitleText.textColor = 0xffffff
            NewTitleText.selectable = false
            NewTitleText.mouseEnabled = false
            inNewDataMC.addChild(NewTitleText)
            var NewTime:TextField = new TextField
            NewTime.text = newUpTime
            NewTime.width = 70
            NewTime.height = 20
            NewTime.x = 480
            NewTime.textColor = 0xffffff
            NewTime.selectable = false
            NewTime.mouseEnabled = false
            inNewDataMC.addChild(NewTime)
            _listMc.addChild(inNewDataMC)
        }
        private function addMovieEve(e:Event):void
        {
            e.currentTarget.alpha = 0}
        private function effect(e:Event):void
        {
            var obj:Object = e.currentTarget;
            obj.alpha += 0.05;
            if (obj.alpha > 0.7)
            {
                obj.removeEventListener(Event.ENTER_FRAME , effect);
            }
        }
    }
}
